package com.pktechan.api.enumeration;

/**
 * 面试邀请函状态枚举
 */
public enum TradeOrderStatusEnum {

    TO_BE_PAID(10, "待付款"),
    ORDERS_TO_BE_RECEIVED(20, "待接单"),
    IN_DELIVERY(30, "配送中"),
    COMPLETED(40, "已完成"),
    CLOSED(-10, "已关闭"),
    REFUND_AUDIT(-20, "退款审核中"),
    REFUNDED(-30, "已退款");

    private Integer code;
    private String name;

    TradeOrderStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getNameByCode(Integer code) {
        for (TradeOrderStatusEnum statusEnum : TradeOrderStatusEnum.values()) {
            if (statusEnum.code.equals(code)) {
                return statusEnum.name;
            }
        }
        return null;
    }
}
